package com.csw.compose.ui.module.component.base

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.VerticalDivider
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.csw.compose.theme.pagePadding
import com.csw.compose.ui.Destination
import com.csw.compose.ui.components.BodyText
import com.csw.compose.ui.components.LabelText
import com.csw.compose.ui.components.NormalSpacer
import com.csw.compose.ui.components.PrimaryTitle
import com.csw.compose.ui.components.UlItem
import com.csw.compose.ui.module.BasePage

@Preview
@Composable
fun DialogPagePreview() {
    BasePage({}, "分隔线（Divider）") {
        DividerPage()
    }
}
class DividerPageData {
    companion object : Destination("DividerPage")
}

/**
 *[参考](https://developer.android.google.cn/develop/ui/compose/components/divider?hl=zh-cn)
 */
@Composable
fun DividerPage() {
    Column(
        modifier = Modifier
            .padding(horizontal = pagePadding)
            .verticalScroll(rememberScrollState())
    ) {
        PrimaryTitle("简介")
        BodyText("Divider 间隔线组件，有此组件，可不用Box设置背景色去模拟间隔线")

        NormalSpacer()
        HorizontalDivider()
        NormalSpacer()
        UlItem("HorizontalDivider")
        LabelText("横向分隔线")

        NormalSpacer()
        VerticalDivider(Modifier.height(200.dp))
        NormalSpacer()
        UlItem("VerticalDivider")
        LabelText("纵向分隔线")
    }
}